<?php
include'social.php';
if ( function_exists('register_sidebar') )
{
register_sidebar();
}
//print_r($_POST);diente zum ausgeben des login fehler kann noch gebraucht werden
// hook failed login
add_action('wp_login_failed', 'my_front_end_login_fail'); 
add_action( 'authenticate', 'hex_front_end_blank_login');
function my_front_end_login_fail($username){
    // Get the reffering page, where did the post submission come from?

	
    $referrer = $_SERVER['HTTP_REFERER'];
  $err =  strstr($referrer,'wp-login');
    // if there's a valid referrer, and it's not the default log-in screen
	
    if(!empty($referrer) && !strstr($referrer,'wp-login') && !strstr($referrer,'wp-admin')){
        // let's append some information (login=failed) to the URL for the theme to use
        wp_redirect($referrer . "?login=".$err);
//wp_redirect("http://pokerface/");		
    exit;
    }
	}
	
	function hex_front_end_blank_login(){
  /*$referrer = $_SERVER['HTTP_REFERER'];
  $err =  "";
  if ( !strstr($referrer,'wp-login') && $user==null ) { // login1 is the name of the loginpage.
    if ( !strstr($referrer, '?login=failed') ) { // make sure we don’t append twice
        wp_redirect( $referrer . "?login=".$err); // let’s append some information (login=failed) to the URL for the theme to use
      } else {
        wp_redirect( $referrer );
      }
      exit;
  }*/
   $referrer = $_SERVER['HTTP_REFERER'];
  $err =  strstr($referrer,'wp-login');
    // if there's a valid referrer, and it's not the default log-in screen
	
    if(empty($referrer) && !strstr($referrer,'wp-login') && !strstr($referrer,'wp-admin')){
        // let's append some information (login=failed) to the URL for the theme to use
        wp_redirect($referrer . "?login=".$err); 
    exit;
	}
	//wp_redirect("http://pokerface/");
	 wp_redirect($referrer . "?login=".$err); 
}
?>